import 'dart:io';

import 'package:flutter_demo2/base/plugin/base_native.dart';

const _channelNameCommon = "common";
const _methodNameFinishSplash = "finishSplash";
const _methodNameOpenNativePage = "openNativePage";
const _methodNameOpenWebView = "openWebView";

final commonNative = CommonNative();

class CommonNative extends BaseNative {
  CommonNative._internal()
      : super(
          "$channelMethod/$_channelNameCommon",
          eventChannelName: "$channelEvent/$_channelNameCommon",
        );

  static final CommonNative _singleton = CommonNative._internal();

  factory CommonNative() => _singleton;

  void finishSplash() {
    if (Platform.isAndroid) {
      nativeMethod(_methodNameFinishSplash);
    }
  }

  void openNativePage() {
    nativeMethod(_methodNameOpenNativePage);
  }

  void openWebView() {
    nativeMethod(_methodNameOpenWebView);
  }
}
